package com.minimalist.common.entity.lindi.vo.news;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.config.swagger.SchemaEnum;
import com.minimalist.common.entity.basic.enums.StatusEnum;
import com.minimalist.common.entity.basic.vo.file.FileVO;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * @author 11987
 */

@Schema(name = "林地指标平台_新闻实体")
public class LindiNewsVO implements Serializable{
    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "新闻ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "newsId", description = "新闻ID", type = "string")
    private Long newsId;

    @NotBlank(message = "新闻标题不能为空", groups = {Add.class, Update.class})
    @Schema(name = "newsTitle", description = "新闻标题", type = "string")
    private String newsTitle;

    @Schema(name = "newsContent", description = "新闻内容", type = "string")
    private String newsContent;

    @Schema(name = "newsTop", description = "是否置顶", type = "boolean")
    private Boolean newsTop;

    @Schema(name = "newsSort", description = "排序", type = "integer")
    private Integer newsSort;

    @Schema(name = "newsPicFileId", description = "新闻封面图片文件ID", type = "string")
    private Long newsPicFileId;
    @Schema(name = "newsPicFile", description = "新闻封面图片文件", type = "object")
    private FileVO newsPicFile;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "publishDeptId", description = "发布部门", type = "integer")
    private Long publishDeptId;

    @JsonSerialize(using = ToStringSerializer.class)
    @NotNull(message = "发布人不能为空", groups = {Add.class, Update.class})
    @Schema(name = "publishAuthorId", description = "发布人ID", type = "string")
    private Long publishAuthorId;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(name = "publishTime", description = "发布时间", type = "string")
    private LocalDateTime publishTime;

    @NotNull(message = "新闻状态不能为空", groups = {Add.class, Update.class})
    @SchemaEnum(implementation = StatusEnum.class)
    @Schema(name = "status", description = "新闻状态", type = "string")
    private Integer status;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "createId", description = "创建人ID", type = "string")
    private Long createId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "createId", description = "更新人ID", type = "string")
    private Long updateId;

    @Schema(name = "createTime", description = "创建时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime createTime;

    @Schema(name = "updateTime", description = "更新时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime updateTime;

    public LindiNewsVO(){
    }

    public Long getNewsId(){
        return newsId;
    }

    public void setNewsId(Long newsId){
        this.newsId = newsId;
    }

    public String getNewsTitle(){
        return newsTitle;
    }

    public void setNewsTitle(String newsTitle){
        this.newsTitle = newsTitle;
    }

    public String getNewsContent(){
        return newsContent;
    }

    public void setNewsContent(String newsContent){
        this.newsContent = newsContent;
    }

    public Boolean getNewsTop(){
        return newsTop;
    }

    public void setNewsTop(Boolean newsTop){
        this.newsTop = newsTop;
    }

    public Integer getNewsSort(){
        return newsSort;
    }

    public void setNewsSort(Integer newsSort){
        this.newsSort = newsSort;
    }

    public Long getNewsPicFileId(){
        return newsPicFileId;
    }

    public void setNewsPicFileId(Long newsPicFileId){
        this.newsPicFileId = newsPicFileId;
    }

    public FileVO getNewsPicFile(){
        return newsPicFile;
    }

    public void setNewsPicFile(FileVO newsPicFile){
        this.newsPicFile = newsPicFile;
    }

    public Long getPublishDeptId(){
        return publishDeptId;
    }

    public void setPublishDeptId(Long publishDeptId){
        this.publishDeptId = publishDeptId;
    }

    public Long getPublishAuthorId(){
        return publishAuthorId;
    }

    public void setPublishAuthorId(Long publishAuthorId){
        this.publishAuthorId = publishAuthorId;
    }

    public LocalDateTime getPublishTime(){
        return publishTime;
    }

    public void setPublishTime(LocalDateTime publishTime){
        this.publishTime = publishTime;
    }

    public Integer getStatus(){
        return status;
    }

    public void setStatus(Integer status){
        this.status = status;
    }

    public Long getCreateId(){
        return createId;
    }

    public void setCreateId(Long createId){
        this.createId = createId;
    }

    public Long getUpdateId(){
        return updateId;
    }

    public void setUpdateId(Long updateId){
        this.updateId = updateId;
    }

    public LocalDateTime getCreateTime(){
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime){
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime(){
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime){
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o){
        if (this == o){
            return true;
        }
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        LindiNewsVO lindiNewsVO = (LindiNewsVO) o;
        return Objects.equals(newsId, lindiNewsVO.newsId) && Objects.equals(newsTitle, lindiNewsVO.newsTitle) && Objects.equals(newsContent, lindiNewsVO.newsContent) && Objects.equals(newsTop, lindiNewsVO.newsTop) && Objects.equals(newsSort, lindiNewsVO.newsSort) && Objects.equals(newsPicFileId, lindiNewsVO.newsPicFileId) && Objects.equals(newsPicFile, lindiNewsVO.newsPicFile) && Objects.equals(publishDeptId, lindiNewsVO.publishDeptId) && Objects.equals(publishAuthorId, lindiNewsVO.publishAuthorId) && Objects.equals(publishTime, lindiNewsVO.publishTime) && Objects.equals(status, lindiNewsVO.status) && Objects.equals(createId, lindiNewsVO.createId) && Objects.equals(updateId, lindiNewsVO.updateId) && Objects.equals(createTime, lindiNewsVO.createTime) && Objects.equals(updateTime, lindiNewsVO.updateTime);
    }

    @Override
    public int hashCode(){
        return Objects.hash(newsId, newsTitle, newsContent, newsTop, newsSort, newsPicFileId, newsPicFile, publishDeptId, publishAuthorId, publishTime, status, createId, updateId, createTime, updateTime);
    }
}
